using System.Linq;
using Liberate.CodeGenerator.Spring.DynamicLoading;
using Spring.Context;

namespace Liberate.CodeGenerator
{
    public static class TemplateConfigLoader
    {
        public static TemplateConfig Load(string configFile)
        {
            IApplicationContext ctx = new XmlApplicationContext(configFile);
            var dic = ctx.GetObjectsOfType(typeof(TemplateConfig));
            var config = dic.Values.Cast<TemplateConfig>().FirstOrDefault();
            return config;
        }
    }
}